<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>面向对象</title>
    <script>
        function getName() {
            console.log(4)
        }

        function Foo() {
            getName = function() {
                console.log(1)
            }
            return this
        }

        Foo.getName = function() {
            console.log(2)
        }


        Foo.getName()
        getName()
        Foo().getName()
        new Foo.getName()
    </script>
</head>

<body>

</body>

</html>